package com.example.lovedogs.zizhen;

import java.util.ArrayList;

import com.example.lovedogs.R;
import com.example.lovedogs.R.id;
import com.example.lovedogs.R.layout;
import com.example.lovedogs.fragment.zizhen.SickInfoStateFragmentLeft;
import com.example.lovedogs.fragment.zizhen.SickInfoStateFragmentRight;

import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class SickInfoStateActivity extends Activity {
	private SickInfoStateFragmentLeft fragmentLeft;
	private SickInfoStateFragmentRight fragmentRight;
	public SickInfoStateFragmentLeft getFragmentLeft() {
		return fragmentLeft;
	}
	public SickInfoStateFragmentRight getFragmentRight() {
		return fragmentRight;
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_sickinfostate);
		titlebar();
		/**
		 * 关联fragmentLeft
		 * 尽管Fragment可以被多个Activity重用，但是您也必须把Fragment关联到一个FragmentActivity上。可以使用XML布局文件的方式来实现这种关联。
		 *使用fragment标签，android:name=””指定一个添加到xml中的Fragment。
		 */
		FragmentManager fm = getFragmentManager();//fragment管理器
		fragmentLeft = (SickInfoStateFragmentLeft)fm.findFragmentById(R.id.fragment_left);
	
		
		fragmentRight=new SickInfoStateFragmentRight();
		//创建fragment对象时可以传递参数
	/*	Bundle bundle = new Bundle();
		fragmentRight.setArguments(bundle);*/
		//结束数据的传递
		FragmentTransaction tran = fm.beginTransaction();
		tran.replace(R.id.fl_holder, fragmentRight);
		tran.commit();
		
	}
	private void titlebar() {
		ImageView imageView1=(ImageView) findViewById(R.id.imageView1);
		
		imageView1.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
					finish();
			}
		});
		TextView textView1=(TextView) findViewById(R.id.textView1);
		textView1.setText("状态");
	}
}
